import { Component, Injector, ViewChild } from '@angular/core';
import { IonicPage, NavController, NavParams, Slides} from 'ionic-angular';
import { BasePage } from '../../basePage';
import { nailerService } from '../../../providers/nailerService';
import { StorageService } from '../../../providers/StorageService';
import { PIC_URL } from "./../../../providers/Config";
declare var Swiper;

/**
 * Generated class for the NailerOrderPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-nailer-order',
  templateUrl: 'nailer-order.html',
})
export class NailerOrderPage extends BasePage {
  picrooturl = "";//图片服务地址
  userinfo: any;
  nailerparamnailerparam={
    user_id:'',
    page_size:'10',
    page_pos:'0'
  }
  nailerList:any;
  flag:boolean;   //缺省字提示
  pop=1;  //分页页码
  swiper: any;
  @ViewChild('contentSlides') contentSlides: Slides;
  items: Array<any> = [0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8];
  menus: Array<string> = ["全部", "有效期","无效期", "查看评价"]

  constructor(injector: Injector,public nailerservice:nailerService,public stc:StorageService) {
    super(injector);
    this.picrooturl = PIC_URL;
    this.userinfo=this.stc.read('userinfo');
    console.log(this.userinfo);
  }

  ionViewDidLoad() {
    console.log('我已经执行');
    this. getNailerList();
  }

  /**上一个页面 */
  dismissCLI() {
    this.navCtrl.pop()
  }
  /**获取美甲师订单列表 */
  async getNailerList(){
    let param={artist_id:this.userinfo['artist_id'],pop:this.pop}
    let res = await this.nailerservice.getArtistOrderListAPI(param);
    console.log(res);
    if(res.code==1){
      this.flag=true;
      this.nailerList=res.data;
    }
    
  }
}
